<%@ page language="java" import="java.util.*,hibernate.VGlUserinfo" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="commontaglib"%>
<%
String path = request.getContextPath();
VGlUserinfo loginUser = (VGlUserinfo)session.getAttribute("login_user") ;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <link rel="stylesheet" href="<%=path%>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/cupertino/jquery-ui.custom.min.css" />
	<script type='text/javascript' src='/glqt/dwr/util.js'></script>
	<script type='text/javascript' src='/glqt/dwr/engine.js'></script>    
    <script type='text/javascript' src='/glqt/dwr/interface/htdwr.js'></script>
    <script type='text/javascript' src='/glqt/dwr/interface/jydz.js'></script>
	<script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/jquery-ui.custom.min.js"></script> 
	<script type="text/javascript" src="<%=path%>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
	<script type="text/javascript" src="<%=path%>/js/jquery.form.js"></script>
	<script type="text/javascript" src="<%=path%>/js/json2.js"></script>
	<script type="text/javascript" src="<%=path%>/js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/messages_zh.js"></script>
	
	
	 <style type="text/css">
    #common_box{width:1000px;position:fixed;_position:absolute;right:0;top:40%;border:1px solid #789;background:#fff;z-index:88}
    #cli_on{width:30px;height:500px;float:left;cursor:pointer;background:#ac8932;text-align:center;line-height:180px}
    </style>
	
	
	<style type="text/css">
		html, body {
			margin: 0;			 
			padding: 0;	 
		    font-size: 85%;
		}
		#tab{
			width:99%;	
			padding:0 2px 3px 2px;
			margin:0;
			float:left;
		}
		#tab h1{
			display:block;
			width:95%;
			height:45px;	
			float:center;
			text-align: center;
			padding-top:5px;
		}
		#tab h1 span{
			width:250px;
			font:bold 26px/55px Arial, Helvetica, sans-serif;
			color:#fff;
			background-color:#fff;
			display:block;
		}
		
		.textbox
		{
			width:90px;
			border:#000 1px solid;
		}
		.textboxs
		{
			width:70px;
			border:#000 1px solid;
		}
		.longtextbox
		{
			width:180px;
			border:#000 1px solid;
		}
		.longtextbox1
		{
			width:180px;
			border:#000 1px solid;
			background-color:#ddd;
		}
		.shorttextbox
		{
			width:50px;
			border:#000 1px solid;
		}
		
		.textarea
		{
		    overflow:auto;	
			border:#000 1px solid;
				
		}
		.textarea1
		{
		    overflow:auto;	
			border:#000 1px solid;
			background-color:#ddd;	
		}
		.select div {
		  border:1px solid #000;
		  float: left;
		}
		label{ display:block; }
		fieldset { padding:0; border:0; margin-top:25px; }
		label.error {  
		        color: red;/*错误信息的颜色*/  
		    }  
		input.error {  
		        border:1px dotted red;/*输入错误的输入框的边框样式*/  
		    }		
	
	</style>
<script type='text/javascript'> 
    //加载出卖单位下拉框
    function loadCmrInfo(){
        var fromqiydm = ${fromjydw.qiydm};
        var toqiydm = ${tojydw.qiydm};     
        var url =null;
        $("#cmrbm").empty();
        $("#cmrbm").append("<option value='-1' selected='selected'>请选择</option>");
        if(${fromjydw.qiylx}==6||${fromjydw.qiylx}==7)//生产 或 经营
        {
            url="<%=path%>/info/findSjdwList.action?qiydm="+fromqiydm;
            $.post(url,function(data){
		            var json = eval('(' + data + ')'); 
			        $("#cmrbm").append("<option value='${fromjydw.qiydm}'>${fromjydw.qiyqc}</option>"); //初始化加载自己  
			        for(var i=0;i<json.length;i++){
			           $("#cmrbm").append("<option value='"+json[i].danwbm+"'>"+json[i].danwmc+"</option>");//加载上级单位
			        }
		           });
        }
        if(${tojydw.qiylx}==6||${tojydw.qiylx}==7)//生产 或 经营
        {
            url="<%=path%>/info/findSjdwList.action?qiydm="+toqiydm;
            $.post(url,function(data){
		            var json = eval('(' + data + ')'); 
		             //初始化加载自己
			        $("#cmrbm").append("<option value='${tojydw.qiydm}'>${tojydw.qiyqc}</option>");  
			        for(var i=0;i<json.length;i++){//加载上级单位   
			           $("#cmrbm").append("<option value='"+json[i].danwbm+"'>"+json[i].danwmc+"</option>");
			        }
		           });     
        }    
    }   
    //加载买受单位下拉框
    function loadMsrInfo(){
        var fromqiydm = ${fromjydw.qiydm};
        var toqiydm = ${tojydw.qiydm};
        var url =null;
        $("#msrbm").empty();
        $("#msrbm").append("<option value='-1' selected='selected'>请选择</option>");
        if(${fromjydw.qiylx}==5||${fromjydw.qiylx}==7)//消费  或 经营
        {
            url="<%=path%>/info/findSjdwList.action?qiydm="+fromqiydm;
            $.post(url,function(data){
		            var json = eval('(' + data + ')'); 
			        $("#msrbm").append("<option value='${fromjydw.qiydm}'>${fromjydw.qiyqc}</option>"); //初始化加载自己  
			        for(var i=0;i<json.length;i++){
			           $("#msrbm").append("<option value='"+json[i].danwbm+"'>"+json[i].danwmc+"</option>");//加载上级单位   
			        }
		           });
        }
        if(${tojydw.qiylx}==5||${tojydw.qiylx}==7)//消费 或 经营
        {
            url="<%=path%>/info/findSjdwList.action?qiydm="+toqiydm;
            $.post(url,function(data){
		            var json = eval('(' + data + ')'); 
			        $("#msrbm").append("<option value='${tojydw.qiydm}'>${tojydw.qiyqc}</option>"); //初始化加载自己  
			        for(var i=0;i<json.length;i++){
			           $("#msrbm").append("<option value='"+json[i].danwbm+"'>"+json[i].danwmc+"</option>");//加载上级单位   
			        }
		           });     
        }    
    }   
    //选择出卖人动作
    function changeTabForCmr(val){
      if(val==-1)
      {
      $("#chumdwmc").val("");
      $("#chumdwdz").val("");
      $("#chumdwfddbr").val("");
      $("#chumdwwtdlr").val("");
      $("#chumdwdh").val("");
      $("#chumdwcz").val("");
      $("#chumdwyzbm").val("");
      $("#chumdwkhyh").val("");
      $("#chumdwzh").val("");
      $("#chumdwnsrdjh").val("");
      return false;
      }
      //选择买受人  自动关联发货单位
      loadFhdwData(val);       
      var url = ""; 
      var fromorgid =${fromuser.orgid};  
      var toorgid =${touser.orgid};      
      if(fromorgid==val||toorgid==val)//是交易商
      { //加载隐藏部分详细信息   
      url = "<%=path%>/info/findJydwList.action?qiydm="+val;
      $.post(url,function(data){
            var json = eval('(' + data + ')');
            $("#chumdwmc").val(json[0].qiyqc);
            $("#chumdwdz").val(json[0].tongxdz);
            $("#chumdwfddbr").val(json[0].faddbr);
            $("#chumdwwtdlr").val(json[0].lianxr);
            $("#chumdwdh").val(json[0].lianxrdh);
            $("#chumdwcz").val(json[0].qiycz);
            $("#chumdwyzbm").val(json[0].qiyyb);
            $("#chumdwkhyh").val(json[0].jiesfzh);
            $("#chumdwzh").val(json[0].jiesyhzh);
            $("#chumdwnsrdjh").val(json[0].shuiwdjzhgs); 
            });      
      }else{//主管单位
      url = "<%=path%>/info/findZgdwList.action?dwbm="+val;
      $.post(url,function(data){
            var json = eval('(' + data + ')');
            $("#chumdwmc").val(json[0].danwmc);
            $("#chumdwdz").val(json[0].zhus);
            $("#chumdwfddbr").val(json[0].faddbr);
            $("#chumdwwtdlr").val(json[0].weitdlr);
            $("#chumdwdh").val(json[0].dianh);
            $("#chumdwcz").val(json[0].chuanz);
            $("#chumdwyzbm").val(json[0].youzbm);
            $("#chumdwkhyh").val(json[0].kaihyh);
            $("#chumdwzh").val(json[0].yinhzh);
            $("#chumdwnsrdjh").val(json[0].nasrdjh); 
            });
      }      
    }   
    //选择买受人动作
    function changeTabForMsr(val){ 
      if(val==-1)
      {
      $("#maisdwmc").val("");
      $("#maisdwdz").val("");
      $("#maisdwfddbr").val("");
      $("#maisdwwtdlr").val("");
      $("#maisdwdh").val("");
      $("#maisdwcz").val("");
      $("#maisdwyzbm").val("");
      $("#maisdwkhyh").val("");
      $("#maisdwzh").val("");
      $("#maisdwnsrdjh").val(""); 
      return false;
      } 
      //选择买受人  自动关联收货单位
      loadShdwData(val);
      var url = ""; 
      var fromorgid =${fromuser.orgid};  
      var toorgid =${touser.orgid};       
      if(fromorgid==val||toorgid==val)//是交易商
      {//加载隐藏部分详细信息
      url = "<%=path%>/info/findJydwList.action?qiydm="+val;
      $.post(url,function(data){
            var json = eval('(' + data + ')');
            $("#maisdwmc").val(json[0].qiyqc);
            $("#maisdwdz").val(json[0].tongxdz);
            $("#maisdwfddbr").val(json[0].faddbr);
            $("#maisdwwtdlr").val(json[0].lianxr);
            $("#maisdwdh").val(json[0].lianxrdh);
            $("#maisdwcz").val(json[0].qiycz);
            $("#maisdwyzbm").val(json[0].qiyyb);
            $("#maisdwkhyh").val(json[0].jiesfzh);
            $("#maisdwzh").val(json[0].jiesyhzh);
            $("#maisdwnsrdjh").val(json[0].shuiwdjzhgs);  
            });      
      }else{//主管单位
      url = "<%=path%>/info/findZgdwList.action?dwbm="+val;
      $.post(url,function(data){
            var json = eval('(' + data + ')');
            $("#maisdwmc").val(json[0].danwmc);
            $("#maisdwdz").val(json[0].zhus);
            $("#maisdwfddbr").val(json[0].faddbr);
            $("#maisdwwtdlr").val(json[0].weitdlr);
            $("#maisdwdh").val(json[0].dianh);
            $("#maisdwcz").val(json[0].chuanz);
            $("#maisdwyzbm").val(json[0].youzbm);
            $("#maisdwkhyh").val(json[0].kaihyh);
            $("#maisdwzh").val(json[0].yinhzh);
            $("#maisdwnsrdjh").val(json[0].nasrdjh);     
            });
      }   
    }
    //加载发货单位信息  调用
    function loadFhdwData(qydwnum){
        var url = "<%=path%>/info/findFhdwList.action?common_qydwnum="+qydwnum;
        $.post(url,function(data){ 
        var projects = eval('(' + data + ')'); 
       $( "#fahdwmc").autocomplete({
			minLength:2,
			source:projects,			
            select: function( event, ui ) {
				$( "#fahdwmc").val( ui.item.label );						
				$( "#fahdwbm").val( ui.item.fahdwbm );						
				return false;
			}
		});
    });
    }
    //加载收货单位信息 调用
    function loadShdwData(qydwnum){
      var url = "<%=path%>/info/findShdwList.action?common_qydwnum="+qydwnum;    
      $.post(url,function(data){ 
        var projects = eval('(' + data + ')'); 
       $( "#shr").autocomplete({
			minLength:2,
			source:projects,			
            select: function( event, ui ) {	
				$( "#shr" ).val( ui.item.label );							
				$( "#shrid" ).val( ui.item.shouhdwbm );						
				return false;
			}
		});
    });
    }
      
    //选择合同形式动作  联动
    function changeTabForHtxs(value){
    $("#hetxsname").val($("#hetxs").find("option:selected").text());
    var fromid = ${fromuser.userid};
    var toid = ${touser.userid};        
    var url = "";
    var projects = "";
    if(value =='1')//选择出省站
    {
      url = "<%=path%>/info/findReChusz.action?fromid="+fromid+"&toid="+toid;
      $.post(url,function(data){ 
        projects = eval('(' + data + ')'); 
        $("#mgz").text("出省站:");
        $("#yingyz").empty();
        if(projects.length==0)
        {
          alert("您与对方均没有定制出省站货没有发运资格。");
        }
        else
        {
           $("#yingyz").append("<option value='-1'>请选择</option>");      
	       for(var i=0;i<projects.length;i++){
	       $("#yingyz").append("<option value='"+projects[i].id+"'>"+projects[i].name+"</option>");
           }
        }       
        });
       loadShsxxData("100000","sheng");
       //清空市
        $("#shi").empty(); 
        $("#shi").append("<option value='-1'>请选择</option>"); 
    }else{//营业站
    url = "<%=path%>/info/findReYingyz.action?fromid="+fromid+"&toid="+toid;
    $.post(url,function(data){ 
        projects = eval('(' + data + ')');
        $("#mgz").text("营业站:");
        $("#yingyz").empty(); 
        if(projects.length==0)
        {
          alert("您与对方均没有定制出省站货没有发运资格。");
        }
        else
        {
        $("#yingyz").append("<option value='-1'>请选择</option>");      
        for(var i=0;i<projects.length;i++){
        $("#yingyz").append("<option value='"+projects[i].id+"'>"+projects[i].name+"</option>");
        }
        }});
        loadShsxxData("140000","sheng"); 
        //清空市
        $("#shi").empty(); 
        $("#shi").append("<option value='-1'>请选择</option>"); 
    }
    } 
     //加载省市信息 调用
    function loadShsxxData(vvalue,tabid){  
        htdwr.findShengSDwr(vvalue,function(data) {
        $("#"+tabid).empty(); 
        $("#"+tabid).append("<option value='-1'>请选择</option>");       
        for(var i=0;i<data.length;i++){
        sObj = data[i];
        $("#"+tabid).append("<option value='"+sObj.regioncode+"'>"+sObj.regionname+"</option>");
        }         
        });        
    }
    
    //选择省市名称动作  存储
    function changeTabForDdss(){
	    $("#daodshengname").val($("#sheng").find("option:selected").text());
	    $("#daodshiname").val($("#shi").find("option:selected").text());
    }
    //选择出省站营业站  存储
    function changeTabForYyzMjglz(){
	    $("#yingyzhmjglz").val($("#yingyz").find("option:selected").text());
    }   
    //选择价格类型名称  存储
    function changeTabForJiaglx(){
	    $("#jiaglxname").val($("#jiaglx").find("option:selected").text());
    } 
    //选择行业名称  存储
    function changeTabForHangy(){
	    $("#hangyname").val($("#hangy").find("option:selected").text());
    }
    //选择煤种  存储
     function changeTabForMeiz(){
    $( "#mzmc").val( $("#mzid").find("option:selected").text());   
    }
    //选择品牌  存储
    function changeTabForPinz(){
    $( "#pzmc").val( $("#pzid").find("option:selected").text());   
    }
 
    
    
    //选择合同条框动作
    function changeTabForHttk(vvalue){    
       jydz.findMbDwr(vvalue,function(data) {
       $( "#httk").children().remove();       
       var dtable = document.getElementById("httk");
       for(var i=0; i<data.length; i++){
       jydzObj=data[i];
       var elTr = dtable.insertRow( -1 );
       var tkTd = elTr.insertCell( -1 );
       var tx ="<span id=\"tkh"+i+"\" >"+jydzObj.tkh+"</span>";
       tkTd.innerHTML = tx;
       var idTd = elTr.insertCell( -1 );
       var sx ="<span id=\"sx"+i+"\" >"+jydzObj.biaot+"</span><input type=\"hidden\" name=\"clausebean["+i+"].biaot\" value=\""+jydzObj.biaot+"\"/>";
       idTd.innerHTML = sx;
       var jfTd = elTr.insertCell(-1);
       var jfyq="<textarea cols=\"142\" rows=\"2\" class=\"textarea\" name=\"clausebean["+i+"].neir\">"+jydzObj.neir+"</textarea>";     
       jfTd.innerHTML=jfyq;
       }
       });
    }
    
    //选择结算单位动作
    function changeTabForJsdw(vvalue,dwlx){
        htdwr.findJsdwDwr(vvalue,function(data) {
        if(dwlx=='1'){//出卖方
              $("#szs").val(data.jiesdwzs);
              $("#sfddbr").val(data.faddbr);
              $("#swtdlr").val(data.weitdlr);
              $("#sdh").val(data.dianh);
              $("#scz").val(data.chuanz);
              $("#syb").val(data.youzbm);
              $("#skhyh").val(data.kaihyh);
              $("#szh").val(data.yinhzh);
              $("#sdjh").val(data.nasrdjh);
              $("#cmdwjsrmc").val( $("#chumdwjsrbm").find("option:selected").text()); 
           }else{//买受方
              $("#bzs").val(data.jiesdwzs);
              $("#bfddbr").val(data.faddbr);
              $("#bwtdlr").val(data.weitdlr);
              $("#bdh").val(data.dianh);
              $("#bcz").val(data.chuanz);
              $("#byb").val(data.youzbm);
              $("#bkhyh").val(data.kaihyh);
              $("#bzh").val(data.yinhzh);
              $("#bdjh").val(data.nasrdjh);
              $("#msdwjsrmc").val( $("#maisdwjsrbm").find("option:selected").text()); 
           }        
        });       
    }
    
    //加载默认品种规格 调用
    function changeTabForPinpDefult(){
        var url = "<%=path%>/htgl/findMtzbDefult.action"
        $.post(url,function(data){ 
          var projects = eval('(' + data + ')'); 
          $( "#mzpz").children().remove(); 
          $("#ppname").val("");      
	       var dtable = document.getElementById("mzpz");  
	       var elTr = dtable.insertRow( -1 );
	       var aTd = elTr.insertCell( -1 );
	       var ax ="<span>煤种:</span>";
	       aTd.innerHTML = ax;
	       var bTd = elTr.insertCell( -1 );
	       var bx ="<div class=\"select\"><div><select id=\"mzid\" onchange=\"changeTabForMeiz();\"/></div></div>";
	       bTd.innerHTML = bx;
	       var cTd = elTr.insertCell( -1 );
	       var cx ="<span>品种:</span>";
	       cTd.innerHTML = cx;
	       var dTd = elTr.insertCell( -1 );
	       var dx ="<div class=\"select\"><div><select id=\"pzid\" onchange=\"changeTabForPinz();\"/></div></div>";
	       dTd.innerHTML = dx;
	       
          for(var i=0;i<projects.pd.length;i++){
              var pz = projects.pd[i];
              $("#pzid").append("<option value='"+pz.diccode+"'>"+pz.dicname+"</option>"); ;
              //alert(pz.dicname);
          }
          for(var j=0;j<projects.md.length;j++){
              var mz =  projects.md[j];
             $("#mzid").append("<option value='"+mz.diccode+"'>"+mz.dicname+"</option>");
          }
          
        $( "#mtzb").children().remove();
        var mtable = document.getElementById("mtzb");
        var nlTr = mtable.insertRow( -1 );
        var iTd = nlTr.insertCell( -1 );
        var ix ="<span>名称</span>";
        iTd.innerHTML = ix;
        var jTd = nlTr.insertCell( -1 );
        var jx ="<span>符号</span>";
        jTd.innerHTML = jx;
        var lTd = nlTr.insertCell( -1 );
        var lx ="<span>下限指标</span>";
        lTd.innerHTML = lx;
        var kTd = nlTr.insertCell( -1 );
        var kx ="<span>上限指标</span>";
        kTd.innerHTML = kx;
        
        
      for(var k=0;k<projects.zd.length;k++){
       var zbObj =projects.zd[k];
       var mlTr = mtable.insertRow( -1 );
       var eTd = mlTr.insertCell( -1 );       
       var ex ="<span>"+zbObj.guanlname+"</span><input type=\"hidden\" id=\"zhibbm"+k+"\" value="+zbObj.guanlid+"><input type=\"hidden\" id=\"zhibmc"+k+"\" value="+zbObj.guanlname+">";
       eTd.innerHTML = ex;
       var fTd = mlTr.insertCell( -1 );
       var fx ="<span>"+zbObj.fuh+"</span><input type=\"hidden\"  id=\"fuh"+k+"\" value="+zbObj.fuh+">";
       fTd.innerHTML = fx;
       var gTd = mlTr.insertCell( -1 );
       var gx ="<input type=\"text\" id=\"shangxz"+k+"\"  class=\"textbox\" >";
       gTd.innerHTML = gx;
       var hTd = mlTr.insertCell( -1 );
       var hx ="<input type=\"text\" id=\"xiaxz"+k+"\"  class=\"textbox\" >";
       hTd.innerHTML = hx;
        }
          
        });
    }   
    //加载品种规格
    function changeTabForPinp(vvalue){ 
        if(vvalue==-1){
        changeTabForPinpDefult();
        }else{    
        var userid = "${fromuser.userid}";
        $("#ppbm").val(vvalue);
        $("#ppname").val($("#ppid").find("option:selected").text());       
        htdwr.findPinpDwr(vvalue,userid,function(data) {         
        $( "#mzpz").children().remove();       
       var dtable = document.getElementById("mzpz");  
       var elTr = dtable.insertRow( -1 );
       var aTd = elTr.insertCell( -1 );
       var ax ="<span>煤种:</span>";
       aTd.innerHTML = ax;
       var bTd = elTr.insertCell( -1 );
       var bx ="<input id=\"mzmc\" value="+data.meizname+" type=\"text\" class=\"textbox\" readonly=\"readonly\"><input type=\"hidden\" id=\"mzid\" value="+data.meiz+">";
       bTd.innerHTML = bx;
       var cTd = elTr.insertCell( -1 );
       var cx ="<span>品种:</span>";
       cTd.innerHTML = cx;
       var dTd = elTr.insertCell( -1 );
       var dx ="<input id=\"pzmc\" value="+data.pinzname+" type=\"text\" class=\"textbox\" readonly=\"readonly\"><input type=\"hidden\" id=\"pzid\" value="+data.pinz+">";
       dTd.innerHTML = dx;
       
        $( "#mtzb").children().remove();
        var mtable = document.getElementById("mtzb");
        var nlTr = mtable.insertRow( -1 );
        var iTd = nlTr.insertCell( -1 );
        var ix ="<span>名称</span>";
        iTd.innerHTML = ix;
        var jTd = nlTr.insertCell( -1 );
        var jx ="<span>符号</span>";
        jTd.innerHTML = jx;
        var lTd = nlTr.insertCell( -1 );
        var lx ="<span>下限指标</span>";
        lTd.innerHTML = lx;
        var kTd = nlTr.insertCell( -1 );
        var kx ="<span>上限指标</span>";
        kTd.innerHTML = kx;        
        
        var mtzbd=data.mtzh;
        for(var i=0; i<mtzbd.length; i++){
        zbObj =mtzbd[i];
       var mlTr = mtable.insertRow( -1 );
       var eTd = mlTr.insertCell( -1 );
       var ex ="<span>"+zbObj.zhibmc+"</span><input type=\"hidden\" id=\"zhibbm"+i+"\" value="+zbObj.zhibbm+"><input type=\"hidden\" id=\"zhibmc"+i+"\" value="+zbObj.zhibmc+">";
       eTd.innerHTML = ex;
       var fTd = mlTr.insertCell( -1 );
       var fx ="<span>"+zbObj.fuh+"</span><input type=\"hidden\"  id=\"fuh"+i+"\" value="+zbObj.fuh+">";
       fTd.innerHTML = fx;
       var hTd = mlTr.insertCell( -1 );
       var hx ="<input type=\"text\" id=\"xiaxz"+i+"\" value="+zbObj.xiaxz+"  class=\"textbox\" >";
       hTd.innerHTML = hx;
       var gTd = mlTr.insertCell( -1 );
       var gx ="<input type=\"text\" id=\"shangxz"+i+"\" value="+zbObj.shangxz+"  class=\"textbox\" >";
       gTd.innerHTML = gx;
      
        }       
        });
       }
    }
    
    //发起协商
    function begaincon()
    {
            var xsbh = $("#xsbh").text();           
	        var url = "<%=path%>/consult/sendContract.action?xsbh="+xsbh;
	         $("#form1").ajaxSubmit({
	              url:url,
	              type:'post',
	              success:function(data){
	              var json =eval('(' + data + ')');
				    if(json.result==0){
					    alert("发起成功！请记住单号："+json.xsbh); 	
					    $("#but_xs").val("修改协商");				    
					    $("#xsbh").text(json.xsbh);
					    //window.returnValue=1;
	                    //window.close();					   
				   }
				   else if(json.result==1)
				   {
				     alert("发起失败！");  
				   }
				   else  if(json.result==2)
				    {
				     alert("保存成功！请记住单号："+json.xsbh);  
				   }
				   else
				   {
				    alert("保存失败！");
				   }
	              }
	         });
    }
    
    
    //弹出确认框
    function confirm(){
           $("#but_final").click(function () {
               $("#dialogconfirm_final").dialog("open");   
               $("#dialogconfirm_final").dialog({  
                   resizable: false,  
                   height: 140,  
                   modal: true,  
                   buttons: {  
                       "发布": function () {  
                           finalcon();
                           $(this).dialog( "close" ); 
                       },  
                       "取消": function () {  
                           $(this).dialog("close");  
                       }  
                   }  
               });  
           });
           } 
    //校验
    function jiaoyan()
    {   
    /**  
	     * 自定义验证规则——增加对select的验证  
	     */  
	    $.validator.addMethod(    
	        "selectNone", 
	        function(value, element)
	        {   
	            if (value == "-1") 
	            {    
	                return false;    
	            }    
	            else    
	            {   
	                return true;    
	            }   
	        },    
	        "必须选择一项" 
	    );   
		
		$("#form1").validate({
		       rules: {	 
		       "contractbean.fahdwmc":"required", 
		       "extendbean.shouhdwmc":"required", 
		       "extendbean.pinzgg":"required", 	
		       "contractbean.chumdwbm":{
		       selectNone:true
		       },
		       "contractbean.yingyzhmjglzbm":{
		       selectNone:true
		       },
		       "contractbean.maisdwbm":{
		       selectNone:true
		       },
		       "contractbean.daodssd":{
		       selectNone:true
		       },
		       "contractbean.daodsheng":{
		       selectNone:true
		       },
		       "contractbean.hetxs":{
		       selectNone:true
		       },
		       "contractbean.jiaglx":{
		       selectNone:true
		       },
		       "contractbean.hangy":{
		       selectNone:true
		       },	       
		       "extendbean.shul":{
		       required: true, 
		       digits:true,
		       range:[0,9999999]
		       },      
		       "extendbean.jiag":{
		       required: true, 
		       number:true,
		       range:[0,3000]
		       }
		       },
			   messages: {
			   "extendbean.shouhdwmc":"请选择收货单位",		   
			   "extendbean.pinzgg":"请选择品种规格",
		       "contractbean.chumdwbm":"请选择出卖单位",
		       "contractbean.yingyzhmjglzbm":"请选择出省站或营业站",
			   "contractbean.maisdwbm":"请选择买受单位",
			   "contractbean.daodssd":"请选择达到省",		   
			   "contractbean.daodsheng":"请选择达到市",
		       "contractbean.hetxs":"请选择合同形式",
		       "contractbean.jiaglx":"请选择价格类型",
		       "contractbean.hangy":"请选择隶属行业",
			   "extendbean.shul":{
		       required: "请输入数量", 
		       digits:"请输入整数",
		       range:jQuery.validator.format("请输入一千万吨之内的数")
		       },
			   "extendbean.jiag":{
			   required:"请输入价格",
			   number:"请输入合法数字",
			   range:jQuery.validator.format("请输入0和3000之间的数")
			   }	   
			   }
			   }); 
    }
    //提交
	function finalcon(){	
                if($("#form1").valid()){
		        var xsbh = $("#xsbh").text();           
		        var url = "<%=path%>/consult/sendfinalContract.action?xsbh="+xsbh;
		         $("#form1").ajaxSubmit({
		              url:url,
		              type:'post',
		              success:function(data){
		              var json =eval('(' + data + ')');
					    if(json.result==0){//发布成功
						    alert("发布成功！请记住单号："+json.xsbh); 
						    $("#xsbh").text(json.xsbh);	
						    $("#but_xs").attr("disabled","disabled"); 
						    $("#but_final").attr("disabled","disabled");			    					   
					   }
					   else 
					   {
					     alert("发布失败！");  
					   }
		              }
		         });
		         }		       	            
	}
	
        //点击品种规格 弹框
	function clickPzgg(){
	 $( "#fh" ).click(function() {
			$( "#pzgg" ).dialog("open");
			$( "#pzgg" ).dialog({
			resizable: false,			
			height: 1000,
		    width: 650,
			modal: true,
			buttons: {
				"确认": function() {
				var str="";
				var ary=[];				
				var j =-1;
				var aryxs=[];
				$("#mtzb").find("tr").each(function(){
				           var tem ="";				           			               			               
				           var djzb = new Object; 
				           var a="",b="";
                           $(this).find("td").each(function(){                           
                           if($(this).find("[id='zhibmc"+j+"']").length>0){                                
                                tem+=$(this).find("[id='zhibmc"+j+"']").val()+":";
                                djzb.zhibmc=$(this).find("[id='zhibmc"+j+"']").val();
                             }                       
                           if($(this).find("[id='zhibbm"+j+"']").length>0){                           
                              djzb.zhibbm=$(this).find("[id='zhibbm"+j+"']").val();                                                     
                             
                             }
                            if($(this).find("[id='fuh"+j+"']").length>0){                             
                             var fh=$(this).find("[id='fuh"+j+"']").val();
                             //特殊符号转码                             
                             djzb.fuh=encodeURIComponent(fh);                                                        
                             if(fh=="-"){
                             a="";
                             b=fh;                            
                             }else if(fh==">" || fh=="≥"){
                             a=fh;
                             b="";                             
                             }else if(fh=="<" || fh=="≤"){
                             a="";
                             b=fh;                             
                             }
                             } 
                          if($(this).find("[id='xiaxz"+j+"']").length>0){                           
                           var xx = $(this).find("[id='xiaxz"+j+"']").val();
                           if(xx!=''){
                           djzb.xiaxz=xx;
                           tem+=a;
                           tem+=xx;
                           }else{
                            djzb.xiaxz='';
                           tem="";                           
                            }                                                      
                           }
                           if($(this).find("[id='shangxz"+j+"']").length>0){                        
                            var sx = $(this).find("[id='shangxz"+j+"']").val();
                            if(sx!=''){
                            djzb.shangxz=sx;
                            tem+=b;
                            tem+=sx;
                            }else{
                             djzb.shangxz='';
                            tem="";
                            }                                                                                                          
                           }
                          
                                });
                                //alert("tem====="+tem);
                                if(tem!="")str+=tem+";";                                
                                ary[j]=JSON.stringify(djzb);   
                                aryxs[j]=djzb;                             
                                j++;
                            });
                            
                            var  str1="";
                             for(k=0;k<j;k++)
                            {
                            //alert(aryxs[0].fuh);
                            var fh=aryxs[k].fuh;
                            var xx =aryxs[k].xiaxz;
                            var sx =aryxs[k].shangxz;                           
                            var zb=aryxs[k].zhibmc
                            
                            if(fh=="-")
                            {    
	                            if (xx!='')
	                            {
		                            if(sx!='')
		                            {
		                            	str1+=zb+" "+xx+fh+sx+";";
		                            } 
		                            else 
		                            {
		                           		str1+=zb+" "+"≥"+xx+";";
		                            }
		                        } 		                            
	                            else if(sx!='')
	                            {
	                            str1+=zb+" "+"≤"+sx+";";
	                            }else
	                            {
	                            }
                            
                            }else if (fh==">" || fh=="≥")
                            {
                            if (xx!='')
	                            {str1+=zb+" "+fh+xx+";";}
                            
                            
                            }else if (fh=="<" || fh=="≤")
                            {
                             if(sx!='')
	                            {
	                            str1+=zb+" "+fh+sx+";";
	                            } 
                            }   
                            }
                            
                            str=str1;
                  //alert(ary.toString()); 
                          
     $("#djzb").val(ary.toString());

    
    var mzpz="";    
    $("#mzpz tr").find("td").each(function(){
        if($(this).find("[id='mzid']").length>0){
            $( "#mzbm").val($(this).find("[id='mzid']").val());
            $( "#mzmc0").val($(this).find("[id='mzmc']").val()); 
            mzpz+=$(this).find("[id='mzmc']").val()+".";
        }
        
        if($(this).find("[id='pzid']").length>0){
            $( "#pzbm").val($(this).find("[id='pzid']").val());
            $( "#pzmc0").val($(this).find("[id='pzmc']").val()); 
            mzpz+=$(this).find("[id='pzmc']").val();
        }                
    
    });	
    //alert(mzpz); 
    var pp="",ppmz="";
    if($("#ppname").val().length>0){    
    pp+=$("#ppname").val()+"("+mzpz+")";    
    }
    ppmz=pp==""?mzpz:pp;
    $( "#fh").val(ppmz); 
    $( "#zlzb").val(str.substring(1, str.length));
                       
    $( this ).dialog( "close" );                              
				},
				
				"返回": function() {
					$( this ).dialog( "close" );
				}
			}		    
		   
		 });	
	  });
	}
	
	
	//计算 
	function txtzjl_onblur() { 
	     if ($("#shul").val() != "") {
                var zjsl = parseFloat($("#shul").val());
                var yuesl = zjsl / 12;
                var intyue = parseInt(yuesl);
                var syysl = intyue * 11;
                var srysl = zjsl - syysl;
                SetYueZJ(intyue, srysl);
                return;
            }
            SetYueZJ(0, 0); 
	     
            
        }
        function SetYueZJ(yuesl, srysl) {
            if(yuesl==0){
            $("#shul").val(yuesl)
            }
            $("#jan").val(yuesl);
            $("#feb").val(yuesl);
            $("#mar").val(yuesl);
            $("#apr").val(yuesl);
            $("#may").val(yuesl);
            $("#jun").val(yuesl);
            $("#jul").val(yuesl);
            $("#aug").val(yuesl);
            $("#sep").val(yuesl);
            $("#oct").val(yuesl);
            $("#nov").val(yuesl);
            $("#dec").val(srysl);            
        }       
     function txtyuesl_onblur() {
            if (!event.srcElement.value) {
                event.srcElement.value = '0'
            }
            var temp = GetYueZJ();
            if (isNaN(temp)) {
                $("#shul").val(0);                
            }
            else {
                $("#shul").val(temp);                
            }

        }
        function GetYueZJ() { 
            var yue1 =parseFloat($("#jan").val());
            var yue2 = parseFloat($("#feb").val());
            var yue3 = parseFloat($("#mar").val());
            var yue4 = parseFloat($("#apr").val());
            var yue5 = parseFloat($("#may").val());
            var yue6 = parseFloat($("#jun").val());
            var yue7 = parseFloat($("#jul").val());
            var yue8 = parseFloat($("#aug").val());
            var yue9 = parseFloat($("#sep").val());
            var yue10 = parseFloat($("#oct").val());
            var yue11 = parseFloat($("#nov").val());
            var yue12 = parseFloat($("#dec").val()); 

            var yuezj = yue1 + yue2 + yue3 + yue4 + yue5 + yue6 + yue7 + yue8 + yue9 + yue10 + yue11 + yue12;
            return yuezj;
        }
     
     //隐藏
     function jsdxxHide(){
     $("#jsdnr1").hide();
     $("#jsdnr").show();
        $.each($("#bjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#bjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#sjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#sjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        });   
     }       
     //显示
     function jsdxxShow(){
     $("#jsdnr").hide();
     $("#jsdnr1").show();
     $.each($("#bjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     $.each($("#sjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       }); 
       $.each($("#bjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     $.each($("#sjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     } 
     
     //聊天室发送消息
     function send()
     {
            var xsbh = $("#xsbh").text();          
	        var url = "<%=request.getContextPath()%>/liaotianshi/sendMessages.action?xsbh="+xsbh;
	         $("#onlineconsult").ajaxSubmit({
	              url:url,
	              type:'post',
	              success:function(data){
	              var json =eval('(' + data + ')');
	              $("#xsbh").text(json.xsbh);
	              $("#content").val("");
	              }
	         });
     }
     
      $(function(){
        loadCmrInfo();
        loadMsrInfo();              
        $("#but1").button();
        $("#but_xs").button();
        $("#but_final").button();       
        $("#but2").button();
        $("#but3").button();
        $("#jsdnr").button();
        $("#jsdnr1").button();
        $("#submit_chat").button();        
        $("#jsdnr1").hide();
        $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]);      
		$( "#pzgg" ).dialog({
		    autoOpen: false,
		    modal: true
		   }); 
		$( "#dialogconfirm_final" ).dialog({
		    autoOpen: false,
		    modal: true
		   });
		confirm(); 
		jiaoyan();  
		jsdxxHide();  
		$("#jsdnr1").click(function(){
		jsdxxHide();		
		});
		$("#jsdnr").click(function(){
		jsdxxShow();		
		}); 
		$( document ).tooltip();
    });	
    
	</script>
	   
    <script language="javascript" src="<%=request.getContextPath()%>/js/liaotianshi.js"></script>
	<script language="javascript">
	window.onload=function(){
	    checkScrollScreen();//当页面载入后控制是否滚屏
		showContent();		
		//页面伸缩
		var combox = document.getElementById("common_box");
	    var cli_on = document.getElementById("cli_on");
	    var flag = true, timer = null, initime = null, r_len = 0;
	    cli_on.onclick = function () {
	    /*如果不需要动态效果，这两句足矣
	    combox.style.right = flag?'-270px':0;
	    flag = !flag;
	    */
	    clearTimeout(initime);
	    //根据状态flag执开展开收缩
	    if (flag) {
	    r_len = 0;
	    timer = setInterval(slideright, 10);
	    } else {
	    r_len = -970;
	    timer = setInterval(slideleft, 10);
	    }
	    }
	    //展开
	    function slideright() {
	    if (r_len <= -970) {
	    clearInterval(timer);
	    flag = !flag;
	    return false;
	    } else {
	    r_len -= 10;
	    combox.style.right = r_len + 'px';
	    }
	    }
	    //收缩
	    function slideleft() {
	    if (r_len >= 0) {
	    clearInterval(timer);
	    flag = !flag;
	    return false;
	    } else {
	    r_len += 10;
	    combox.style.right = r_len + 'px';
	    }
	    }
	    //加载后3秒页面自动收缩
	    initime = setTimeout("cli_on.click()", 1000);
	    }
	
            
		function showContent(){
		    var xsbh = $("#xsbh").text();  
			var loader1=new net.AjaxRequest("<%=request.getContextPath()%>/liaotianshi/getMessages.action?nocache="+new Date().getTime()+"&xsbh="+xsbh+"&toid="+${touser.userid},deal_content,onerror,"POST");
		}
		
		function deal_content(){
			var returnValue=this.req.responseText;		//获取Ajax处理页的返回值
			content_show.innerHTML=returnValue;
		}
		window.setInterval("showContent();",1000);  
		
		//控制是否滚屏
	    function checkScrollScreen(){
		if(!onlineconsult.scrollScreen.checked){
			document.getElementById("content_show").style.overflow='scroll';
			//document.getElementById('content_show').scrollTop = document.getElementById('content_show').scrollHeight*2;
			//setTimeout('checkScrollScreen()',500);
		}else{
			document.getElementById("content_show").style.overflow='hidden';
			document.getElementById('content_show').scrollTop = document.getElementById('content_show').scrollHeight*2;	//当聊天信息超过一屏时，设置最先发送的聊天信息不显示
		}
		setTimeout('checkScrollScreen()',500);
	    }
	</script>

  </head>
  
  <body>
    <div id="common_box">
    <div id="cli_on">协商交易</div>
    <div>
			  <table width="965.5" height="276px" border="0" align="center" cellpadding="0" cellspacing="0">
			  <tr>
			    <td width="965.5"  height="276px" valign="top" bgcolor="#F7FDAD" style="padding:5px; ">
				<div style="height:290px; overflow:hidden" id="content_show">聊天内容</div>
				</td>
			  </tr>
			  </table>
			  <form  id="onlineconsult" method="post" >
			  <table width="965.5" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#D6D3CE" bgcolor="#D1E9AA">  
			  <tr>
			    <td height="37" align="left">&nbsp;</td>
			    <td height="37" align="left">
			    <input type="hidden" name="fromuserid" value="${fromuser.userid}">
			    <input type="hidden" name="touserid" value="${touser.userid}">  
			    <input type="hidden" name="from"  value="<%=loginUser.getOrgname()%>(<%=loginUser.getRolename()%>:<%=loginUser.getUsername()%>)"/>
			    <input type="hidden"  name="to" value="${touser.orgname}(${touser.rolename}:${touser.username})">
			    <input type="hidden" name="fromusermc" value="${fromuser.orgname}">
                <input type="hidden" name="tousermc" value="${touser.orgname}">		    
			    [ 我 ] 对  [ ${touser.orgname}(${touser.rolename}:${touser.username})] 说：
			    <td width="19" align="left">&nbsp;</td>		
			  <tr>
			    <td width="21" height="30" align="left">&nbsp;</td>
			    <td width="575" align="left">
			      <input style="display:none">
			      <input id="content" name="content" type="text"  size="70"  onKeyDown="if(event.keyCode==13 && event.ctrlKey){send();}">
			      <input id="submit_chat"  type="button"  value="发送" onClick="send();">(按ctrl+enter键直接发送)
			    </td>			 
			  </tr>
			  <tr>
		      <td width="21" height="30" align="left">&nbsp;</td>
			   <td width="575" align="left">是否滚屏显示
              <input name="scrollScreen" type="checkbox" class="noborder" id="scrollScreen" onClick="checkScrollScreen()" value="1" checked></td>
              </tr>
			</table>
			</form>
    </div>
    </div>

<div id="tab">
<h1>协 商 交 易</h1>协商编号： <span id="xsbh" >unassignment</span>

<form name="form1" id="form1">
<input type="hidden" name="consultinfo.fromuserid" value="${fromuser.userid}">
<input type="hidden" name="consultinfo.touserid" value="${touser.userid}">
<input type="hidden" name="fromusermc" value="${fromuser.orgname}">
<input type="hidden" name="tousermc" value="${touser.orgname}">
<input id="djzb" type="hidden" name="extendbean.djzb" >
<table id="list_search" cellpadding="0" cellspacing="0" border="0">
        <tr>
        	<td> 
            	出卖人（销方）: 
            </td>
            <td>
            	<div class="select"><div>
            	<select id="cmrbm" name="contractbean.chumdwbm" style="width:180px;" onchange="changeTabForCmr(this.value)" >          	
            	</select>            	    
            	</div></div>
            </td>
            <td>
            	发货单位:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
                <input id="fahdwmc" name="contractbean.fahdwmc" type="text" class="longtextbox" title="请录入汉字或简拼关键字选择发货单位"/>
            	<input id="fahdwbm" type="hidden" name="contractbean.fahdwbm">
            </td>
            <td>  
                <span id="mgz">出省站/营业站:</span><span style="color: red;font-size:16px;vertical-align:middle;">*</span>  
            </td>
            <td>
            	<div class="select"><div title="请先选择合同形式">
            	<select id="yingyz" name="contractbean.yingyzhmjglzbm" style="width:180px;" onchange="changeTabForYyzMjglz(this.value);"></select>            	
            	</div></div>
            	<input type="hidden" id="yingyzhmjglz" name="contractbean.yingyzhmjglz">  
            </td> 
        </tr>
        
		<tr>
        	<td>
            	买受人（购方）:
            </td>
            <td>
            	<div class="select"><div>            
            	<select id="msrbm" name="contractbean.maisdwbm" style="width:180px;" onchange="changeTabForMsr(this.value)" >  
            	</select>            
            	</div></div>        	
            </td>
            <td>签约地点:<span style="color: red;font-size:16px;vertical-align:middle;">*</span></td>
            <td><input type="text" name="contractbean.qianydd" class="longtextbox" value="中煤交网上交易平台" readonly/></td>
            <td>
                                          到达省、地（市）:
            </td>
            <td>            	 
            	<div class="select"><div title="请先选择合同形式"><select id="sheng" name="contractbean.daodsheng" style="width:90px;" onchange="loadShsxxData(this.value,'shi')" ></select></div></div>
                <div class="select"><div><select id="shi" name="contractbean.daodssd" style="width:90px;" onchange="changeTabForDdss()" ></select></div></div>
                <input type="hidden" id="daodshengname" name="contractbean.daodshengname"> 
                <input type="hidden" id="daodshiname" name="contractbean.daodshiname"> 
            </td>       
        </tr>
        
        <tr>
        	<td>
            	合同形式:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<div class="select"><div><s:select style="width:180px;" id="hetxs" name="contractbean.hetxs" headerKey="-1" headerValue="请选择" list="htxsList" listKey="diccode" listValue="dicname" onchange="changeTabForHtxs(this.value);"/></div></div>   
            	<input type="hidden" id="hetxsname" name="contractbean.hetxsname">              
            </td>
            <td>
            	价格类型:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<div class="select"><div><s:select style="width:180px;" id="jiaglx" name="contractbean.jiaglx" headerKey="-1" headerValue="请选择" list="jglxList" listKey="diccode" listValue="dicname" onchange="changeTabForJiaglx(this.value);"/></div></div>   
            	<input type="hidden" id="jiaglxname" name="contractbean.jiaglxname">             
            </td>
            <td>
                                        隶属行业:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>                       
            </td>
            <td>            	 
            	<div class="select"><div><s:select style="width:180px;" id="hangy" name="contractbean.hangy" headerKey="-1" headerValue="请选择" list="hyList" listKey="diccode" listValue="dicname" onchange="changeTabForHangy(this.value);"/></div></div>   
            	<input type="hidden" id="hangyname" name="contractbean.hangyname">          	
            </td>            
        </tr>
        
        <tr><td colspan="6" style="padding-top:5px;">一、收货人名称、品种规格、交（提）货时间、数量 </td></tr>
       <tr>
        	<td colspan="6" style="padding:1px;">
            <table id="changdi" align="center" cellpadding="0" cellspacing="0" class="content_gridview">
            <thead>
            <tr>
              <th rowspan="3">收货人名称</th>
              <th rowspan="3">品种规格<span style="color: red;font-size:16px;vertical-align:middle;">*</span></th>
              <th rowspan="3">质量指标</th>
              <th rowspan="3">价格</th>
              <th colspan="13">交（提）货时间、煤量（吨）<span style="color: red;font-size:16px;vertical-align:middle;">*</span></th>              
            </tr>
            <tr>
              <th rowspan="2">全年合计<span style="color: red;font-size:16px;vertical-align:middle;">*</span><br><a href="#" onclick="txtzjl_onblur();" style="text-decoration:none;cursor: hand"><img src="<%=path%>/images/pinf.gif" border=0 alt="平分" align= "absmiddle" height="18"  width="18"></a>&nbsp;&nbsp;<a href="#" onclick="SetYueZJ(0,0);" style="border:0px;text-decoration:none;cursor: hand"><img src="<%=path%>/images/qinl.gif"  border=0 alt="清零" align="absmiddle" height="18"  width="18"></a></th>
              <th colspan="3">一季度</th>
              <th colspan="3">二季度</th>
              <th colspan="3">三季度</th>
              <th colspan="3">四季度</th>
            </tr>
            <tr>
              <th>1</th>
              <th>2</th>
              <th>3</th>
              <th>4</th>
              <th>5</th>
              <th>6</th>
              <th>7</th>
              <th>8</th>
              <th>9</th>
              <th>10</th>
              <th>11</th>
              <th>12</th>
            </tr>
          </thead>
            <tbody>
                <tr>
                    <td>
                    <textarea id="shr" cols="15" rows="3" name="extendbean.shouhdwmc" class="textarea" title="请录入汉字关键字选择收货人"></textarea>                    
                    <input id="shrid" type="hidden" name="extendbean.shouhdwbm" />
                    </td>
                    <td>
                    <textarea id="fh" cols="12" rows="3" name="extendbean.pinzgg" class="textarea" readonly="readonly" onclick="clickPzgg();" title="请鼠标点击后操作"></textarea>
                    <input type="hidden" id="mzbm" name="extendbean.meizbm">
                    <input type="hidden" id="mzmc0" name="extendbean.meiz">
                    <input type="hidden" id="pzbm" name="extendbean.pinzbm">
                    <input type="hidden" id="pzmc0" name="extendbean.pinz">
                    </td>
                    <td>
                    <textarea id="zlzb" cols="30" rows="3" class="textarea" name="extendbean.zhilzb"></textarea>
                    </td>
                    <td>
                    <input id="jiag" type="text" class="shorttextbox" name="extendbean.jiag"  title="请输入0和3000之间的数"/>
                    </td>
                    <td>
                    <input id="shul" type="text" class="textboxs" name="extendbean.shul" title="请输入一千万吨之内的数">
                    </td>
                    <td><input id="jan" type="text" class="shorttextbox" name="extendbean.gml1" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="feb" type="text" class="shorttextbox" name="extendbean.gml2" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="mar" type="text" class="shorttextbox" name="extendbean.gml3" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="apr" type="text" class="shorttextbox" name="extendbean.gml4" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="may" type="text" class="shorttextbox" name="extendbean.gml5" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="jun" type="text" class="shorttextbox" name="extendbean.gml6" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="jul" type="text" class="shorttextbox" name="extendbean.gml7" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="aug" type="text" class="shorttextbox" name="extendbean.gml8" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="sep" type="text" class="shorttextbox" name="extendbean.gml9" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="oct" type="text" class="shorttextbox" name="extendbean.gml10" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="nov" type="text" class="shorttextbox" name="extendbean.gml11" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="dec" type="text" class="shorttextbox" name="extendbean.gml12" onclick="txtyuesl_onblur();" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>                    
                </tr> 
            </tbody>
            </table>
            </td>
        </tr>
        <tr>
        	
            <td >
                                        条款模板:
            </td>
            <td colspan="5">            	 
            	<div class="select"><div><s:select name="contractbean.mobbm" list="mbtk" listKey="mobbm" listValue="mobmc" onchange="changeTabForHttk(this.value)"/></div></div>
            </td>            
        </tr>
        <tr>
        	<td colspan="6">
        	<table id="httk" cellpadding="0" cellspacing="0" border="0" class="content1">
        	<s:iterator value="httk" status="i">
        	<tr>
        	<td width="400px">        	
        	<c:property name="tkh"/><c:property name="biaot"/><input type="hidden" name="clausebean[${i.index}].biaot" value="${biaot}"/>
        	</td>
        	<td>
        	<textarea cols="142" rows="2" class="textarea" name="clausebean[${i.index }].neir">${neir}</textarea>
        	</td>
        	</tr>
        	</s:iterator>
        	</table>
        	</td>
        </tr>
        <tr>
        <td colspan="6">
        
        <table  cellpadding="0" cellspacing="0" style="width:100%" class="content_gridview">
        <thead>        
            <tr>                
                <th colspan="2">出卖人(销方)</th>
                <th colspan="2">买受人（购方）</th>                
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
					<table id="sjsdnr" cellpadding="0" cellspacing="0" border="0" class="content1" >
					       <tr>
					        	<td> 
					            	出卖人名称：
					            </td>
					            <td>
					            	<input type="text" class="longtextbox" id="chumdwmc" name="contractbean.chumdwmc" /> 
					            </td>           
					        </tr>
					       
					        <tr>
					        	<td> 
					            	住 所: 
					            </td>
					            <td>
					            	<input id="chumdwdz" type="text" name="contractbean.chumdwdz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	法定代表人: 
					            </td>
					            <td>
					            	<input id="chumdwfddbr" type="text" name="contractbean.chumdwfddbr" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	委托代理人: 
					            </td>
					            <td>
					            	<input id="chumdwwtdlr" type="text" name="contractbean.chumdwwtdlr" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	电 话: 
					            </td>
					            <td>
					            	<input id="chumdwdh" type="text" name="contractbean.chumdwdh" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	传真: 
					            </td>
					            <td>
					            	<input id="chumdwcz" type="text" name="contractbean.chumdwcz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	邮政编码: 
					            </td>
					            <td>
					            	<input id="chumdwyzbm" type="text" name="contractbean.chumdwyzbm" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	开户银行: 
					            </td>
					            <td>
					            	<input id="chumdwkhyh" type="text" name="contractbean.chumdwkhyh" class="longtextbox" /> 
					            </td>           
					        </tr>        
					        <tr>
					        	<td> 
					            	帐号: 
					            </td>
					            <td>
					            	<input id="chumdwzh" type="text" name="contractbean.chumdwzh" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	纳税人登记号: 
					            </td>
					            <td>
					            	<input id="chumdwnsrdjh" type="text" name="contractbean.chumdwnsrdjh" class="longtextbox" /> 
					            </td>           
					        </tr>
					       
					</table>
					</td>
					                <td><table id="sjsdnr1" cellpadding="0" cellspacing="0" border="0" class="content1" >
					       <tr>
					        	<td> 
					            	出卖人结算单位名称：<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
					            </td>
					            <td>
					            	<div class="select"><div><s:select style="width:180px;" id="chumdwjsrbm" name="contractbean.chumdwjsrbm" headerKey="-1" headerValue="请选择" list="jsdwList" listKey="jiesdwbm" listValue="jiesdwmc" onchange="changeTabForJsdw(this.value,'1')"/></div></div>
					                <input id="cmdwjsrmc" type="hidden" name="contractbean.chumdwjsrmc">
					            </td>           
					        </tr>
					        
					        <tr>
					        	<td> 
					            	住 所: 
					            </td>
					            <td>
					            	<input id="szs" type="text" name="contractbean.chumdwjsrdz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	法定代表人: 
					            </td>
					            <td>
					            	<input id="sfddbr" type="text" name="contractbean.chumdwjsrfddbr" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	委托代理人: 
					            </td>
					            <td>
					            	<input id="swtdlr" type="text" name="contractbean.chumdwjsrwtdlr" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	电 话: 
					            </td>
					            <td>
					            	<input id="sdh" type="text" name="contractbean.chumdwjsrdh" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	传真: 
					            </td>
					            <td>
					            	<input id="scz" type="text" name="contractbean.chumdwjsrcz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	邮政编码: 
					            </td>
					            <td>
					            	<input id="syb" type="text" name="contractbean.chumdwjsryzbm" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	开户银行: 
					            </td>
					            <td>
					            	<input id="skhyh" type="text" name="contractbean.chumdwjsrkhyh" class="longtextbox" /> 
					            </td>           
					        </tr>        
					        <tr>
					        	<td> 
					            	帐号: 
					            </td>
					            <td>
					            	<input id="szh" type="text" name="contractbean.chumdwjsrzh" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	纳税人登记号: 
					            </td>
					            <td>
					            	<input id="sdjh" type="text" name="contractbean.chumdwjsrnsrdjh" class="longtextbox" /> 
					            </td>           
					        </tr>
					        
					</table></td>
					                <td><table id="bjsdnr" cellpadding="0" cellspacing="0" border="0" class="content1" >
					       <tr>
					        	<td>  
					            	买受人名称： 
					            </td>
					            <td>
					            	<input  id="maisdwmc" name="contractbean.maisdwmc" type="text"  class="longtextbox" /> 
					            </td>           
					        </tr>
					       
					        <tr>
					        	<td> 
					            	住 所: 
					            </td>
					            <td>
					            	<input id="maisdwdz" type="text" name="contractbean.maisdwdz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	法定代表人: 
					            </td>
					            <td>
					            	<input id="maisdwfddbr" type="text" name="contractbean.maisdwfddbr" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	委托代理人: 
					            </td>
					            <td>
					            	<input id="maisdwwtdlr" type="text" name="contractbean.maisdwwtdlr" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	电 话: 
					            </td>
					            <td>
					            	<input id="maisdwdh" type="text" name="contractbean.maisdwdh" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	传真: 
					            </td>
					            <td>
					            	<input id="maisdwcz" type="text" name="contractbean.maisdwcz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	邮政编码: 
					            </td>
					            <td>
					            	<input id="maisdwyzbm" type="text" name="contractbean.maisdwyzbm" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	开户银行: 
					            </td>
					            <td>
					            	<input id="maisdwkhyh" type="text" name="contractbean.maisdwkhyh" class="longtextbox" /> 
					            </td>           
					        </tr>        
					        <tr>
					        	<td> 
					            	帐号: 
					            </td>
					            <td>
					            	<input id="maisdwzh" type="text" name="contractbean.maisdwzh" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	纳税人登记号: 
					            </td>
					            <td>
					            	<input id="maisdwnsrdjh" type="text" name="contractbean.maisdwnsrdjh" class="longtextbox" /> 
					            </td>           
					        </tr>
					       
					</table></td>
					                <td><table id="bjsdnr1" cellpadding="0" cellspacing="0" border="0" class="content1" >
					       <tr>
					        	<td>  
					            	买受人结算单位名称：<span style="color: red;font-size:16px;vertical-align:middle;">*</span> 
					            </td>
					            <td>            	
					            	<div class="select"><div><s:select style="width:180px;" id="maisdwjsrbm" name="contractbean.maisdwjsrbm" headerKey="-1" headerValue="请选择" list="jsdwList" listKey="jiesdwbm" listValue="jiesdwmc" onchange="changeTabForJsdw(this.value,'2')"/></div></div>
					                <input id="msdwjsrmc" type="hidden" name="contractbean.maisdwjsrmc">
					            </td>           
					        </tr>
					        
					        <tr>
					        	<td> 
					            	住 所: 
					            </td>
					            <td>
					            	<input id="bzs" type="text" name="contractbean.maisdwjsrdz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	法定代表人: 
					            </td>
					            <td>
					            	<input id="bfddbr" type="text" name="contractbean.maisdwjsrfddbr" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	委托代理人: 
					            </td>
					            <td>
					            	<input id="bwtdlr" type="text" name="contractbean.maisdwjsrwtdlr" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	电 话: 
					            </td>
					            <td>
					            	<input id="bdh" type="text" name="contractbean.maisdwjsrdh" class="longtextbox" /> 
					            </td>           
					        </tr>
					         <tr>
					        	<td> 
					            	传真: 
					            </td>
					            <td>
					            	<input id="bcz" type="text" name="contractbean.maisdwjsrcz" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	邮政编码: 
					            </td>
					            <td>
					            	<input id="byb" type="text" name="contractbean.maisdwjsryzbm" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	开户银行: 
					            </td>
					            <td>
					            	<input id="bkhyh" type="text" name="contractbean.maisdwjsrkhyh" class="longtextbox" /> 
					            </td>           
					        </tr>        
					        <tr>
					        	<td> 
					            	帐号: 
					            </td>
					            <td>
					            	<input id="bzh" type="text" name="contractbean.maisdwjsrzh" class="longtextbox" /> 
					            </td>           
					        </tr>
					        <tr>
					        	<td> 
					            	纳税人登记号: 
					            </td>
					            <td>
					            	<input id="bdjh" type="text" name="contractbean.maisdwjsrnsrdjh" class="longtextbox" /> 
					            </td>           
					        </tr>
					       
					</table></td>				
					            </tr>
              </tbody>
       </table>
 
 
        </td>
        
        </tr>
        
        <tr><td>&nbsp;</td></tr>
              
        <tr>
		    <td colspan="6" align="center">	
		    <input id="but_xs" type="button"  value="发起协商" onclick="begaincon();"/>&nbsp;&nbsp;&nbsp;
		    <input id="but_final" type="button"  value="发布合同" />&nbsp;&nbsp;&nbsp;  
		    <input type="button" id="jsdnr1" value="隐藏">&nbsp;&nbsp;&nbsp; 		    
		    <input type="button" id="jsdnr" value="展开">&nbsp;&nbsp;&nbsp;    	    
		    <input id="but3" type="button"  value="关闭" onclick="window.returnValue=1;window.close();"/>
		    </td>            
        </tr>
  </table>  
  
</form>
</div> 
	
<div id="pzgg" title="品种规格">	

	<table cellpadding="0" cellspacing="0" class="content">
	<tr>
	<td>品牌名称：</td>
	<td algin="left">
	<div class="select"><div>
	<s:select id="ppid" headerKey="-1" headerValue="=====请选择====="  list="ppList" listKey="pinpbh" listValue="pinpmc" onchange="changeTabForPinp(this.value)"/></div></div>
	<input type="hidden" id="ppname">
	</td>
	</tr>
	
	<tr>
	<td colspan="2">
	<table id="mzpz" cellpadding="0" cellspacing="0" class="content">
	<tr>
	<td>煤种:</td>
	<td><div class="select"><div><s:select id="mzid"  headerKey="-1" headerValue="=请选择=" list="mzList" listKey="diccode" listValue="dicname" onchange="changeTabForMeiz();"/></div></div>
	<input type="hidden" id="mzmc">
	</td>
	<td>品种:</td>
	<td><div class="select"><div><s:select id="pzid" headerKey="-1" headerValue="=请选择=" list="pzList" listKey="diccode" listValue="dicname" onchange="changeTabForPinz();"/></div></div>
	<input type="hidden" id="pzmc">
	</td>
	</tr>
	</table>
	</td>
	</tr>
	
	<tr>
	<td colspan="2">
	
	<table id="mtzb" cellpadding="0" cellspacing="0" class="content">
	<tr>
	<th>名称</th>
	<th>符号</th>
	<th>下限指标</th>
	<th>上限指标</th>	
	</tr>
	
	<s:iterator value="mtzbList" status="i">
	<tr>
	<td>
		<c:property name="guanlname"/><input type="hidden" id="zhibbm${i.index}" value="${guanlid}"/><input type="hidden" id="zhibmc${i.index}" value="${guanlname}"/>
	</td>
	<td>
	   <c:property name="fuh"/><input type="hidden" id="fuh${i.index}" value="${fuh}"/>
	</td>
	<s:if test="fuh=='>'||fhu=='≥'">
	<td>&nbsp;</td>
	</s:if>
	<s:else>
	<td>	
	<input type="text" id="xiaxz${i.index}" class="textbox">
	</td>
	</s:else>
	<s:if test="fuh=='<'||fhu=='≤'">
	<td>&nbsp;</td>
	</s:if>
	<s:else>
	<td>
	<input type="text" id="shangxz${i.index}" class="textbox">
	</td>
	</s:else>	
	</tr>
	</s:iterator>	
	</table>
	
	</td>
	</tr>
	
	</table>	
	

</div>
 <div id="dialogconfirm_final" title="确认发布?">  
      <p >  
          <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>  
                确认要发布么？发布之后将不能修改,协商方确认后合同即达成。</p>  
  </div>  
  </body>
</html>

